<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn"  uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="form"uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%@page import="biblioteca.persistencia.*"%>
<%@page import="biblioteca.dao.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="/stylesheets/menu.css" media="screen"/>
        
        <link rel="icon" type="image/vnd.microsoft.icon" href="/favicon.ico"/>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
        <link rel="stylesheet" href="/stylesheets/style.css" type="text/css" media="screen" />  
        <script src="./jQuery/js/jquery-latest.pack.js" type="text/javascript"></script>  
        <script src="./jQuery/js/jcarousellite_1.0.1c4.js" type="text/javascript"></script>
        <script src="./jQuery/js/jquery-1.4.4.min.js" type="text/javascript"></script>
        
  
        
        
        <script language="javascript" type="text/javascript">
            $(document).ready(
            function(){
             <%if(request.getParameter("error")!=null){%>
             alert("Comprueba usuario y contraseña");
            <%}%>
            }
);
        </script>
        
     <script type="text/javascript">
$(function(){
	$('#nav>li').hover(
		function(){
		$('.submenu',this).stop(true,true).slideDown('fast');
		},
		function(){
		$('.submenu',this).slideUp('fast');
		}
	);
 
	$('.submenu li a').css( {backgroundPosition: "0px 0px"} ).hover(
		function(){
		$(this).stop().animate({backgroundPosition: "(0px -99px)"}, 250);
		},
		function(){
		$(this).stop().animate({backgroundPosition: "(0px 0px)"}, 250);
		}
	);			
});
</script>    
        
        
        <script type="text/javascript">
$(document).ready(function(){
        $('#login-trigger').click(function(){
                $(this).next('#login-content').slideToggle();
                $(this).toggleClass('active');                                  

                if ($(this).hasClass('active')) $(this).find('span').html('&#x25B2;')
                        else $(this).find('span').html('&#x25BC;')
                })
});
  </script>
        
<script type="text/javascript">
$(function() {
	$(".newsticker-jcarousellite").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 3,
		auto:9000,
		speed:10000
	});
});
</script>
           
    <title>Biblioteca DAI</title>
      
    
  </head>

  <body>

	
	<ul id="nav">
		<li><a href="#"  title="Fuciones con los libros">Libros </a>
			<ul class="submenu">
                            <li><a href="/catalogo">Catálogo</a></li>
                            <sec:authorize access="hasRole('ROLE_ADMIN')">
                            <li><a href="/ir_crear_libro" >Alta Libro</a></li>
                            </sec:authorize>
			</ul>
                </li>
			
			
		<li> <a href="" title="Funciones con los socios">Socios</a>
			<ul class="submenu">
                            <sec:authorize access="hasRole('ROLE_ADMIN')">
                            <li><a href="/ir_altaSocio">Alta de Socio</a></li>
                            </sec:authorize>
                            <li><a href="/catalogo">Listado Socios</a></li>
			</ul>
                    
                </li>
				
		<li> <a href="#"  title="Prestamo">Prestamos</a> 
                    <ul class="submenu">
                        <li><a>Prestamos</a></li>
                        <li><a>Devolucion</a></li> 
                    </ul>   
                </li>
                    
		
		<li><a href="/listado_Noti" title="Listar">Noticias</a>	
			<ul class="submenu">
                            <sec:authorize access="hasRole('ROLE_ADMIN')">
                            <li><a href="/ir_crear_noticia" >Agregrar Noticias</a></li>
                            </sec:authorize>
                            <li><a href="/listado_Noti">Noticias</a></li>
			</ul>
                </li>   
                
	</ul>
      
      <%--<iframe src="/inicio_sesion" align="right" ></iframe>--%>
      

      
        
  <nav>
        <ul>
                <li id="login">
                    <c:if test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal}">
                  <font color="black"><a>Hola <c:out value=" ${usuario.username}, ahora puedes "></c:out></a></font>
                  </c:if>
                    <c:choose>
                        <c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal}">
                            <a></a>
                        </c:when>
                            <c:otherwise>
                        <a id="login-trigger">Inicia sesion<span>▼</span></a>
                        <div id="login-content">
                            <form action="/login" method="get">
                                  <fieldset id="inputs">
                                      <input id="username"  name="username" placeholder="Nombre Usuario" required>
                                      <input id="password" type="password" name="password" placeholder="Contraseña" required>
                                  </fieldset>
                                    <fieldset id="actions">
                                          <input type="submit" id="submit" value="conectar">
                                    </fieldset>
                             </form>
                        </div>
                       </c:otherwise>
                        </c:choose>
                </li>                 
                 
                <li id="signup">
                    <c:choose>
                     <c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal}">
                       <li><a href="/logout">desconectarte<img src=""></img></a></li>
                     </c:when>
                    <c:otherwise>
                        <a href="ir_registro">Registrate</a>
                        </c:otherwise>
                        </c:choose>
                       
        </ul>
</nav>
  
  

  <div id="newsticker-demo">    
    <div class="title">Últimas Novedades</div>

    <div class="newsticker-jcarousellite">
		<ul>
        <c:choose>
        <c:when test="${!empty plantilla}">
            <c:forEach var="noticia" items="${plantilla}">
           <li>
				<div class="thumbnail">
					<img src="http://www.webdesignbooth.com/demo/news-ticker/images/6.jpg">
				</div>
				<div class="info">
					<a href="/listado_Noti"></a>
				</div>
                             <c:out value="${noticia.titulo}."/><a href="/listado_Noti"></a>
				<div class="clear"></div>
			</li>
           </c:forEach>
        </c:when>
  </c:choose>
        </ul>
    </div>
</div>
  
  
        
                                        
  </body>
</html>
